package com.lam.schedule.common.scheduler.model;

import com.lam.common.utils.StringUtils;

public class ScheduleProperties {
	
	private String targetClassPackage;
	
	private boolean isClustered = true;
	
	/** RAM内存jobStore，不会持久化到数据库，只支持单机版，不支持集群；DataSource会持久化到数据库，支持单机版和集群  */
	private String jobStore = "DataSource";
	
	private int threadCount;
	
	private int threadPriority;

	public String getTargetClassPackage() {
		return targetClassPackage;
	}

	public void setTargetClassPackage(String targetClassPackage) {
		this.targetClassPackage = targetClassPackage;
	}

	public String getThreadCount() {
		return String.valueOf(threadCount < 1 ? 20 : threadCount);
	}

	public void setThreadCount(int threadCount) {
		this.threadCount = threadCount;
	}

	public String getThreadPriority() {
		return String.valueOf(threadPriority < 1 ? 5 : threadCount);
	}

	public void setThreadPriority(int threadPriority) {
		this.threadPriority = threadPriority;
	}

	public boolean isClustered() {
		return isRamJobStore() ? false: isClustered;
	}
	
	public void setClustered(boolean isClustered) {
		this.isClustered = isClustered;
	}

	public boolean isRamJobStore() {
		return StringUtils.containsAny(getJobStore(), "RAM");
	}
	
	public String getJobStore() {
		return jobStore;
	}

	public void setJobStore(String jobStore) {
		this.jobStore = jobStore;
	}

}
